/* eslint-disable @typescript-eslint/no-explicit-any */
import type { UserInfoResult } from '@/stores/authStore';
import request from '@/utils/request'
import type { AxiosPromise } from 'axios';
//登录
export const _userLogin = (params: object): any => {
  return request({
    url: '/auth/do-login',
    method: 'GET',
    params: params,
  });
}

//登出
export const _userLogout = (): AxiosPromise<any> => {
  return request({
    url: '/auth/logout',
    method: 'POST',
  });
}
export const _fetchRoutesFromBackend = (): any => {
  return request({
    url: '/menu/query-all',
    method: 'GET'
  });
}

//获取用户信息
export const _getUserInfo = (): AxiosPromise<UserAuthInfoResult> => {
  return request({
    url: '/auth/get-user-info',
    method: 'GET',
  });
}


interface UserAuthInfoResult {
  systemUserRespVO: UserInfoResult;
  menuTreeRespVOList: Record<string, any[]>;
  moduleRespVOList: Moduleinfo[];
}

interface Moduleinfo {
  menuName: string;
  moduleKey :string;
  icon : string;
}
